<template>
  <div id="app">
    <myHeader>{{headerTitle}}</myHeader>
    <router-view />
    <myFooter></myFooter>
  </div>
</template>

<script>
import myHeader from "./components/myHeader";
import myFooter from "./components/myFooter";

import { computed,watch } from "vue";
import { useStore } from "vuex";
import { useRouter } from "vue-router";
export default {
  components: {
    myHeader,
    myFooter,
  },
  setup() {
    const store = useStore(),
      state = store.state,
      router = useRouter();
    router.push("/");

    watch(
      () => {
        return router.currentRoute.value.name;
      },
      (value) => {
        store.commit("setHeaderTitle",value);
      }
    );

    return computed(() => state).value;
  },
};
</script>

<style lang="less">
body,
html {
  margin: 0;
  padding: 0;
}
a {
  text-decoration: none;
  color: #333;
  font-size: 16px;
}
</style>
